<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.11.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>cppMISC: udp类 参考</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<script type="text/javascript" src="../../clipboard.js"></script>
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../resize.js"></script>
<script type="text/javascript" src="../../cookie.js"></script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/searchdata.js"></script>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/javascript" src="../../darkmode_toggle.js"></script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">cppMISC<span id="projectnumber">&#160;v1.1</span>
   </div>
   <div id="projectbrief">cppMisc 文档系统</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.11.0 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
/* @license-end */
</script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() { codefold.init(1); });
/* @license-end */
</script>
<script type="text/javascript" src="../../menudata.js"></script>
<script type="text/javascript" src="../../menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('../../',true,false,'search.php','搜索',false);
  $(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function(){ initResizable(false); });
/* @license-end */
</script>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">载入中...</div>
<div class="SRStatus" id="Searching">搜索中...</div>
<div class="SRStatus" id="NoMatches">未找到</div>
</div>
</div>
</div>
</div>

</div><!-- top -->
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#nested-classes">类</a> &#124;
<a href="#pub-methods">Public 成员函数</a> &#124;
<a href="#pub-attribs">Public 属性</a> &#124;
<a href="../../df/dc6/classudp-members.html">所有成员列表</a>  </div>
  <div class="headertitle"><div class="title">udp类 参考</div></div>
</div><!--header-->
<div class="contents">

<p>UDP协议  
 <a href="#details">更多...</a></p>

<p><code>#include &lt;<a class="el" href="../../d0/d66/linux_2udp_8hpp_source.html">udp.hpp</a>&gt;</code></p>
<div class="dynheader">
类 udp 继承关系图:</div>
<div class="dyncontent">
<div class="center"><img src="../../d1/d61/classudp__inherit__graph.png" border="0" usemap="#audp_inherit__map" alt="Inheritance graph"/></div>
<map name="audp_inherit__map" id="audp_inherit__map">
<area shape="rect" title="UDP协议" alt="" coords="5,192,209,544"/>
<area shape="rect" href="../../db/d78/structdata_ch.html" title=" " alt="" coords="21,5,194,144"/>
<area shape="poly" title=" " alt="" coords="110,159,110,192,105,192,105,159"/>
</map>
</div>
<div class="dynheader">
udp 的协作图:</div>
<div class="dyncontent">
<div class="center"><img src="../../da/d99/classudp__coll__graph.png" border="0" usemap="#audp_coll__map" alt="Collaboration graph"/></div>
<map name="audp_coll__map" id="audp_coll__map">
<area shape="rect" title="UDP协议" alt="" coords="11,1372,215,1724"/>
<area shape="rect" href="../../db/d78/structdata_ch.html" title=" " alt="" coords="5,1169,179,1308"/>
<area shape="poly" title=" " alt="" coords="100,1323,104,1372,99,1373,95,1323"/>
<area shape="rect" href="../../dd/da1/structudp_1_1st_msg.html" title=" " alt="" coords="203,1204,365,1273"/>
<area shape="poly" title=" " alt="" coords="268,1274,221,1358,217,1356,263,1272"/>
<area shape="rect" href="../../da/d39/classwheels_1_1malloc_shared_ptr.html" title=" " alt="" coords="177,647,391,1105"/>
<area shape="poly" title=" " alt="" coords="287,1105,287,1187,281,1187,281,1105"/>
<area shape="rect" title=" " alt="" coords="188,319,337,388"/>
<area shape="poly" title=" " alt="" coords="267,403,277,647,272,647,262,403"/>
<area shape="rect" href="../../da/d39/classwheels_1_1malloc_shared_ptr.html" title=" " alt="" coords="362,124,579,583"/>
<area shape="poly" title=" " alt="" coords="386,597,368,648,363,646,381,596"/>
<area shape="rect" title=" " alt="" coords="394,5,547,75"/>
<area shape="poly" title=" " alt="" coords="473,90,473,124,468,124,468,90"/>
</map>
</div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="nested-classes" name="nested-classes"></a>
类</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../dd/da1/structudp_1_1st_msg.html">stMsg</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-methods" name="pub-methods"></a>
Public 成员函数</h2></td></tr>
<tr class="memitem:a97912bb2f0f451bb3c19f378eca64144" id="r_a97912bb2f0f451bb3c19f378eca64144"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a97912bb2f0f451bb3c19f378eca64144">udp</a> (const std::string &amp;addr, int port, bool bind=false)</td></tr>
<tr class="separator:a97912bb2f0f451bb3c19f378eca64144"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5ed3ccaabf5a80c8ac25ed299d459b63" id="r_a5ed3ccaabf5a80c8ac25ed299d459b63"><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a5ed3ccaabf5a80c8ac25ed299d459b63">~udp</a> ()</td></tr>
<tr class="separator:a5ed3ccaabf5a80c8ac25ed299d459b63"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae07b4453ce543689a6b2db8f77084f11" id="r_ae07b4453ce543689a6b2db8f77084f11"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ae07b4453ce543689a6b2db8f77084f11">send</a> (const std::string &amp;daddr, uint16_t dport, const char *data, size_t len)</td></tr>
<tr class="separator:ae07b4453ce543689a6b2db8f77084f11"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1a96e9d2480e4e1afce13df8de35b7fd" id="r_a1a96e9d2480e4e1afce13df8de35b7fd"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a1a96e9d2480e4e1afce13df8de35b7fd">send</a> (const std::string &amp;addr, uint16_t dport, <a class="el" href="../../da/d39/classwheels_1_1malloc_shared_ptr.html">wheels::mallocSharedPtr</a>&lt; char &gt; &amp;<a class="el" href="../../d5/d36/classwheels_1_1buff.html">buff</a>)</td></tr>
<tr class="separator:a1a96e9d2480e4e1afce13df8de35b7fd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a82110e55d4388bc5503a0c5fce70988d" id="r_a82110e55d4388bc5503a0c5fce70988d"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a82110e55d4388bc5503a0c5fce70988d">onReadyRead</a> (const char *data=nullptr, size_t len) final</td></tr>
<tr class="separator:a82110e55d4388bc5503a0c5fce70988d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8004315f700e559e2a1ceca7933fc842" id="r_a8004315f700e559e2a1ceca7933fc842"><td class="memItemLeft" align="right" valign="top">virtual nativeH_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a8004315f700e559e2a1ceca7933fc842">native_handle</a> () final</td></tr>
<tr class="separator:a8004315f700e559e2a1ceca7933fc842"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-attribs" name="pub-attribs"></a>
Public 属性</h2></td></tr>
<tr class="memitem:ae8976236f3e459766c0390a1877a73c1" id="r_ae8976236f3e459766c0390a1877a73c1"><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="../../dd/da1/structudp_1_1st_msg.html">udp::stMsg</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ae8976236f3e459766c0390a1877a73c1">m_fd__</a></td></tr>
<tr class="separator:ae8976236f3e459766c0390a1877a73c1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pub_attribs_structdata_ch"><td colspan="2" onclick="javascript:dynsection.toggleInherit('pub_attribs_structdata_ch')"><img src="../../closed.png" alt="-"/>&#160;Public 属性 继承自 <a class="el" href="../../db/d78/structdata_ch.html">dataCh</a></td></tr>
<tr class="memitem:a10a58a51fe8cd1be6341144a5e9af598 inherit pub_attribs_structdata_ch" id="r_a10a58a51fe8cd1be6341144a5e9af598"><td class="memItemLeft" align="right" valign="top"><a class="el" href="../../de/dfb/data_ch_8hpp.html#a26fac20c91f664a1fc2936bfddc87112">chType</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../db/d78/structdata_ch.html#a10a58a51fe8cd1be6341144a5e9af598">m_type</a></td></tr>
<tr class="separator:a10a58a51fe8cd1be6341144a5e9af598 inherit pub_attribs_structdata_ch"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">详细描述</h2>
<div class="textblock"><p>UDP协议 </p>
<dl class="section version"><dt>版本</dt><dd>1.0 </dd></dl>
<dl class="section author"><dt>作者</dt><dd>宋炜 </dd></dl>
<dl class="section date"><dt>日期</dt><dd>2023-08-25 </dd></dl>

<p class="definition">在文件 <a class="el" href="../../d0/d66/linux_2udp_8hpp_source.html">udp.hpp</a> 第 <a class="el" href="../../d0/d66/linux_2udp_8hpp_source.html#l00017">17</a> 行定义.</p>
</div><h2 class="groupheader">构造及析构函数说明</h2>
<a id="a97912bb2f0f451bb3c19f378eca64144" name="a97912bb2f0f451bb3c19f378eca64144"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a97912bb2f0f451bb3c19f378eca64144">&#9670;&#160;</a></span>udp()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">udp::udp </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;</td>          <td class="paramname"><span class="paramname"><em>addr</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int</td>          <td class="paramname"><span class="paramname"><em>port</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool</td>          <td class="paramname"><span class="paramname"><em>bind</em></span><span class="paramdefsep"> = </span><span class="paramdefval">false</span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p class="definition">在文件 <a class="el" href="../../d6/d64/udp_8cpp_source.html">udp.cpp</a> 第 <a class="el" href="../../d6/d64/udp_8cpp_source.html#l00011">11</a> 行定义.</p>

</div>
</div>
<a id="a5ed3ccaabf5a80c8ac25ed299d459b63" name="a5ed3ccaabf5a80c8ac25ed299d459b63"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5ed3ccaabf5a80c8ac25ed299d459b63">&#9670;&#160;</a></span>~udp()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">udp::~udp </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p class="definition">在文件 <a class="el" href="../../d6/d64/udp_8cpp_source.html">udp.cpp</a> 第 <a class="el" href="../../d6/d64/udp_8cpp_source.html#l00040">40</a> 行定义.</p>

</div>
</div>
<h2 class="groupheader">成员函数说明</h2>
<a id="a8004315f700e559e2a1ceca7933fc842" name="a8004315f700e559e2a1ceca7933fc842"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8004315f700e559e2a1ceca7933fc842">&#9670;&#160;</a></span>native_handle()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual nativeH_t udp::native_handle </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">final</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>实现了 <a class="el" href="../../db/d78/structdata_ch.html#ac58c0dde99cef17a9d095d066479897c">dataCh</a>.</p>

</div>
</div>
<a id="a82110e55d4388bc5503a0c5fce70988d" name="a82110e55d4388bc5503a0c5fce70988d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a82110e55d4388bc5503a0c5fce70988d">&#9670;&#160;</a></span>onReadyRead()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void udp::onReadyRead </td>
          <td>(</td>
          <td class="paramtype">const char *</td>          <td class="paramname"><span class="paramname"><em>data</em></span><span class="paramdefsep"> = </span><span class="paramdefval">nullptr</span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t</td>          <td class="paramname"><span class="paramname"><em>len</em></span>&#160;)</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">final</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>实现了 <a class="el" href="../../db/d78/structdata_ch.html#aec26b87a6293709885e7ce6b4348cc69">dataCh</a>.</p>

<p class="definition">在文件 <a class="el" href="../../d6/d64/udp_8cpp_source.html">udp.cpp</a> 第 <a class="el" href="../../d6/d64/udp_8cpp_source.html#l00087">87</a> 行定义.</p>
<div class="dynheader">
函数调用图:</div>
<div class="dyncontent">
<div class="center"><img src="../../da/d35/classudp_a82110e55d4388bc5503a0c5fce70988d_cgraph.png" border="0" usemap="#ada/d35/classudp_a82110e55d4388bc5503a0c5fce70988d_cgraph" alt=""/></div>
<map name="ada/d35/classudp_a82110e55d4388bc5503a0c5fce70988d_cgraph" id="ada/d35/classudp_a82110e55d4388bc5503a0c5fce70988d_cgraph">
<area shape="rect" title=" " alt="" coords="5,5,139,32"/>
<area shape="rect" href="../../de/d44/classwheels_1_1dm_1_1singleton.html#ab064e1d47abf923e4ae0deaac875c173" title="获取当前的模块对象指针" alt="" coords="187,5,361,32"/>
<area shape="poly" title=" " alt="" coords="139,16,171,16,171,21,139,21"/>
</map>
</div>

</div>
</div>
<a id="a1a96e9d2480e4e1afce13df8de35b7fd" name="a1a96e9d2480e4e1afce13df8de35b7fd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1a96e9d2480e4e1afce13df8de35b7fd">&#9670;&#160;</a></span>send() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void udp::send </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;</td>          <td class="paramname"><span class="paramname"><em>addr</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t</td>          <td class="paramname"><span class="paramname"><em>dport</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="../../da/d39/classwheels_1_1malloc_shared_ptr.html">wheels::mallocSharedPtr</a>&lt; char &gt; &amp;</td>          <td class="paramname"><span class="paramname"><em>buff</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p class="definition">在文件 <a class="el" href="../../d6/d64/udp_8cpp_source.html">udp.cpp</a> 第 <a class="el" href="../../d6/d64/udp_8cpp_source.html#l00066">66</a> 行定义.</p>

</div>
</div>
<a id="ae07b4453ce543689a6b2db8f77084f11" name="ae07b4453ce543689a6b2db8f77084f11"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae07b4453ce543689a6b2db8f77084f11">&#9670;&#160;</a></span>send() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void udp::send </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;</td>          <td class="paramname"><span class="paramname"><em>daddr</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t</td>          <td class="paramname"><span class="paramname"><em>dport</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *</td>          <td class="paramname"><span class="paramname"><em>data</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t</td>          <td class="paramname"><span class="paramname"><em>len</em></span>&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p class="definition">在文件 <a class="el" href="../../d6/d64/udp_8cpp_source.html">udp.cpp</a> 第 <a class="el" href="../../d6/d64/udp_8cpp_source.html#l00045">45</a> 行定义.</p>

</div>
</div>
<h2 class="groupheader">类成员变量说明</h2>
<a id="ae8976236f3e459766c0390a1877a73c1" name="ae8976236f3e459766c0390a1877a73c1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae8976236f3e459766c0390a1877a73c1">&#9670;&#160;</a></span>m_fd__</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">struct <a class="el" href="../../dd/da1/structudp_1_1st_msg.html">udp::stMsg</a> udp::m_fd__</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<hr/>该类的文档由以下文件生成:<ul>
<li>include/mandarava/linux/<a class="el" href="../../d0/d66/linux_2udp_8hpp_source.html">udp.hpp</a></li>
<li>src/mandarava/linux/<a class="el" href="../../d6/d64/udp_8cpp_source.html">udp.cpp</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.11.0
</small></address>
</div><!-- doc-content -->
</body>
</html>
